/* function TreeNode(x) {
    this.val = x;
    this.left = null;
    this.right = null;
} */
function Print(pRoot)
{
    // write code here
    if(pRoot === null) return []
    let res = []
    let queue = []
    queue.push(pRoot)
    while(queue.length){
      let temp = []
      let n = queue.length
      for(let i = 0;i < n;i++){
        let node = queue.shift()
        temp.push(node.val)
        if(node.left){
          queue.push(node.left)
        }
        if(node.right){
          queue.push(node.right)
        }
      }
      res.push(temp)
    }
    return res
}
module.exports = {
    Print : Print
};